package com.lvyuanj.core.mavenclean;

import java.util.concurrent.Delayed;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;

import com.lvyuanj.core.mavenclean.util.DelLastUpdated;
import com.lvyuanj.core.mavenclean.util.InstallJarToRepo;

public class CleanApplication{
	
	public static void main(String[] args) throws ParseException {
		Options options = new Options();
		options.addOption("t","type",true,"type params");
		options.addOption("j", "jarPath", true, "install jar path");
		options.addOption("p", "repoPath", true, "maven repo path");
		
		CommandLineParser parser = new DefaultParser();
		CommandLine cmd = parser.parse(options, args);
		
		if("add".equals(cmd.getOptionValue("type"))){
			String path = cmd.getOptionValue("jarPath");
			System.out.println("install jar path:"+path);
			InstallJarToRepo.executeMain(path);
		}else if("del".equals(cmd.getOptionValue("type"))){
			String path = cmd.getOptionValue("repoPath");
			System.out.println("maven repo path:"+path);
			DelLastUpdated.executeMain(path);
		}else{
			System.exit(1);
		}
	}
}
